package servlet;

import bean.load;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "Register", value = "/Register")
public class Register extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        response.setContentType("text/html;charset=utf-8");
        String ur=request.getParameter("ur");
        String pwd=request.getParameter("pwd");
        String name=request.getParameter("name");
        String sex=request.getParameter("sex");
        String email=request.getParameter("email");
        String phone=request.getParameter("phone");
        String adr=request.getParameter("adr");
        load ld = new load();
        String SQL;
        SQL="insert into act (id,pwd,name,sex,email,phone,address) value('"+ur+"','"+pwd+"','"+name+"','"+sex+"','"+email+"','"+phone+"','"+adr+"')";
        ld.opert(SQL);
        response.sendRedirect("/HospitalAppointmentReg_Sys_war_exploded/jsp/login.jsp");//页面跳转
    }
}
